home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
L2C_19.ZIP
/
LISP2C19.TXT
< prev
next >
Wrap
Text File
|
1993-06-25
|
36KB
|
830 lines
(C) 1993 BASIC d.o.o Ljubljana,
Jure Spiler,
Jesenkova 5,
61000 Ljubljana, Slovenia
tel: +386 1 314 069
fax: +386 1 318 211
CompuServe: [70541,1765]
e-mail:
Jure Spiler, director jure.spiler@public1.noprmd.mail.si
Joze Marincek joze.marincek@uni-lj.si
Lisp2C
AutoLISP to C (ADS) treanslator
user's guide
version 1.9 (22-June-1993)
Table of Contents
Table of Contents 2
1. INTRODUCTION 3
2. INSTALLATION 4
2.1.DOS - WATCOM 4
2.2.DOS - METAWARE 4
2.3.WINDOWS - WATCOM 4
2.4.WINDOWS - METAWARE 5
2.5. DOS Example (Watcom) 5
3. THE USAGE 6
3.1. COMMAND LINE INPUT 6
3.2. INTERACTIVE INPUT 7
3.3. PROJECT FILE 8
3.4. SWITCHES 8
3.5. COMPILING THE CODE (WATCOM) 9
3.6. LINKING (WATCOM) 10
3.7. BINDING (WATCOM) 10
4. SUPPORTED FUNCTIONS 11
5. DIFFERENCES AND LIMITATIONS 12
5.1. EXPRESSIONS OUTSIDE THE FUNCTIONS 12
5.2 NUMBER OF ARGUMENTS 12
5.3. PASSING SYMBOLS, SUBROUTINES ETC. 12
5.4. PASSING LISTS OF INTEGERS ETC. 12
5.5. BUILD-IN PRIMITIVES 12
5.6. GLOBAL SYMBOLS 12
5.7. A SYMBOL TABLE 13
5.8. NENTSEL, NENTSELP 13
5.9. ATOMS-FAMILY 13
5.10. COMMAND 13
5.12. SPEED 13
6. FEATURES 14
6.1. A GARBAGE COLLECTOR 14
6.2. S::L2CSTARTUP FUNCTION 14
6.3. AUTOMATIC S::L2CSTARTUP GENERATION 14
6.4. SCOPING 14
6.5. MEM FUNCTION 14
6.6. DEBUGGER 14
7. A PROGRAMMER'S VIEW 15
7.1. SymExp 15
7.2. A FUNCTION CALL MECHANISM 15
7.3. NAMING CONVENTIONS 16
APPENDIX 17
A. EXAMPLE: DLINE.LSP 17
1. INTRODUCTION
Lisp2Cads translates an AutoLISP source file(s) into C source files
that can be further compiled using the Watcom or Metaware C
compiler.
Why would anyone bother to compile the existing .LISP code?
First, this completely protects your algorithms. If you use ordinary
AutoLISP, you have to provide source that can be read by AutoCAD.
But then it can also be read by a human. Therefore all of your know-
how is exposed to everyone interested.
Second, an ADS environment is gaining more and more acceptance.
Lisp2C is a great way to preserve all your investments into Lisp
(trainig, coding) and slowly moving to the ADS.
And finally, Lisp2C also includes a debugging tool that is easy to use
yet powerful.
Requirements are:
* AutoCAD R12 (Dos, Windows)
* Watcom C/386 9.0 (9.01d required for Windows), or
* Metaware C/C++ 3.1 and PharLap DOS Extender/Linker
You need DOS4GW.EXE to run L2C.EXE!
Lisp2Cads consists of:
1. QSTART.TXT How to quick - start LISP2C
LISP2C.DOC This file (Word for Windows)
LISP2C.TXT This file (ASCII)
2. L2C.EXE Lisp to C compiler
3. L2C.H Header file, included into source
4. L2C.LIB Libs: (Watcom -DOS)
WINL2C.LIB (Watcom - Windows)
MWL2C.LIB (Metaware - DOS)
MWWINL2C.LIB (Metaware - Windows)
5. DEMO.LSP Sample Lisp program
6. DLINE.LSP Sample LISP from ACAD12
STARTUP.LSP Direct statements from DLINE
DLINE.L2C Project file to compile DLINE.LSP
Other example files may appear in distribution.
2. INSTALLATION
2.1.DOS - WATCOM
Install your Watcom C/386 9.0 or later compiler and compile at least
one sample file (eg TOWER.C) from \ACAD\ADS, to ensure that the
compiler is set up properly.
Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE
(Watcom DOS extender) into directory pointed by a system variable
PATH. We suggest C:\DOS or C:\ACAD directory.
Place L2C.LIB and L2C.H files into \ACAD\ADS directory. Point to
this directory with L2C variable:
SET L2C=C:\ACAD\ADS
Change INCLUDE variable to include \ACAD\ADS directory:
SET INCLUDE=C:\WATCOM\H;C:\ACAD\ADS
2.2.DOS - METAWARE
Install your Metaware HighC/C++ 3.1 compiler and compile at least
one sample file (eg TOWER.C) from \ACAD\ADS, to ensure that the
compiler is set up properly.
Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE
(Watcom DOS extender) into directory pointed by a system variable
PATH. We suggest C:\DOS or C:\ACAD directory.
Place MWL2C.LIB and L2C.H files into \ACAD\ADS directory.
Point to this directory with L2C variable:
SET L2C=C:\ACAD\ADS
Change IPATH variable to include \ACAD\ADS directory:
SET IPATH=C:\HIGHC\H;C:\ACAD\ADS
Note that paths must be set before Lisp file is converted into C
source. L2C uses the values of these variables to produce .BAT and
.MW files. If those values are not set or set properly, .BAT and .MW
files may not compile the C files. This does not, however, corrupt
produced C code in any way.
2.3.WINDOWS - WATCOM
Install your Watcom C/386 9.01d or later compiler and compile at
least one sample file (eg TOWER.C) from \ACADWIN\ADS, to
ensure that the compiler is set up properly.
Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE
(Watcom DOS extender) into directory pointed by a system variable
PATH. We suggest C:\DOS or C:\ACADWIN directory.
Place L2CWIN.LIB and L2C.H files into \ACADWIN\ADS
directory. Point to this directory with L2C variable:
SET L2C=C:\ACADWIN\ADS
Change INCLUDE variable to include \ACADWIN\ADS:
SET INCLUDE=C:\WATCOM\H;C:\ACADWIN\ADS
Copy the file ADS.ICO from ADS\WIN directory to your working
directory.
2.4.WINDOWS - METAWARE
Install your Metaware HighC/C++ 3.1 compiler and compile at least
one sample file (eg TOWER.C) from \ACADWIN\ADS, to ensure
that the compiler is set up properly.
Tip: Read README.ADS from ACADWin. Use -NOSTUB switch
with PharLap linker 5.0 or later. Earlier versions of PharLap do not
need this switch.
Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE
(Watcom DOS extender) into directory pointed by a system variable
PATH. We suggest C:\DOS or C:\ACAD directory.
Place MWL2CWIN.LIB and L2C.H files into \ACADWIN\ADS
directory. Point to this directory with L2C variable:
SET L2C=C:\ACADWIN\ADS
Change IPATH variable to include \ACADWIN\ADS directory:
SET IPATH=C:\HIGHC\H;C:\ACADWIN\ADS
Note that paths must be set before Lisp file is converted into C
source. L2C uses the values of these variables to produce .BAT and
.MW files. If those values are not set or set properly, .BAT and .MW
files may not compile the C files. This does not, however, corrupt
produced C code in any way.
Copy the file ADS.ICO from \ACADWIN\ADS\WIN directory to
your working directory. Again, this only affects the compilation with
produced .BAT and other files.
2.5. DOS Example (Watcom)
Place the rest of the files into your working directory. These files are
included only as a demonstration and can be deleted altogether.
Example:
Let us assume that you have correctly set up the Watcom C/386 9.0
to the C:\WATCOM directory. Thus, when you type SET, you might
see something like
PATH=...C:\ACAD;C:\WATCOM\BIN;C:\WATCOM\BINB
;C:\WATCOM\LIB386\DOS;...
WATCOM=C:\WATCOM\.
INCLUDE=C:\WATCOM\H
In order to use ADS, your C:\ACAD\ADS directory should contain at
least the following files:
WCADS90.LIB
ADSLIB.H
ADSDLG.H
ADS.H
ADSCODES.H
If those files are missing, you can copy them from our distribution.
Now you can copy L2C.EXE to C:\ACAD directory (listed in path),
and L2C.H, L2C.LIB into C:\ACAD\ADS directory. Also, you should
change the INCLUDE variable so that Watcom C/386 will search for
header (.h) files also in C:\ACAD\ADS directory:
SET INCLUDE=C:\WATCOM\H;C:\ACAD\ADS
And finally, you should set the L2C system variable to
C:\ACAD\ADS:
SET L2C=C:\ACAD\ADS
3. THE USAGE
3.1. COMMAND LINE INPUT
The syntax is:
L2C [options] file [file...]
where options are
d includes debugging information
oname sets the output file name to 'name', instead to the
name of 1st input file name
c compiler (cWAT = Watcom, cMW = Metaware)
e compiles every function separately
y "yes" to all questions (except for the registration)
n "no" to all questions (except for the registration)
t target (currently Dos or WIndows)
? displays simple help
The option must be preceded with either / or - character. If an invalid
option is specified, program terminates with a message.
File is the name of AutoLISP source file. L2C produces file.C
file (if more than one file is specified, the first name is taken, unless
/oname option is used). In ad